//
//  AppDelegate.m
//  大宝微博
//
//  Created by bao on 16/2/27.
//  Copyright © 2016年 bao. All rights reserved.
//

#import "AppDelegate.h"
#import "DBTabbarController.h"
#import "DBWelcomController.h"
@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    
    //[NSThread sleepForTimeInterval:2.0];
    
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    
    self.window.rootViewController = [[DBWelcomController alloc] init];
    
    [self.window makeKeyAndVisible];

    
    [self setupTintColor];
    //添加通知的监听者
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeVC) name:@"notificationPost" object:nil];
    
    
    return YES;
}

- (void)setupTintColor
{
    //设置navigation的controller来记性呢
    [UINavigationBar appearance].tintColor = [UIColor orangeColor];
    [UITabBar appearance].tintColor = [UIColor orangeColor];
}
//删除监听着
- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (void)changeVC
{
    self.window.rootViewController = [[DBTabbarController alloc] init];
}
- (void)applicationWillResignActive:(UIApplication *)application {
    
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
